import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-07-14
 * Time: 18:53
 */
public class test2 {
    public static void main(String[] args) {
        int M = 15;
        int N = 2;
        String result = convertToNBase(M, N);
        System.out.println(result);
    }
    public static String convertToNBase(int M, int N) {
        if (M == 0) {
            return "0";
        }
        StringBuilder sb = new StringBuilder();
        while (M > 0) {
            int remainder = M % N;
            sb.insert(0, remainder);
        }
        return sb.toString();
    }
}
